<?php



//print_r($_SESSION);

if(isset($_SESSION['request']))
{
	echo "session";
	$_REQUEST=$_SESSION['request'];
}

if(isset($_REQUEST))
{
	session_start();
	//echo "request";
	$_SESSION['request']=$_REQUEST;
	//print_r($_SESSION['request']);
	/*echo "<pre>";
	print_r($_SESSION['request']);
	echo "</pre>";*/
}
/*echo "<pre>";
print_r($_SESSION);
echo "</pre>";

echo "<pre>";
print_r($_REQUEST);
echo "</pre>";*/

//print_r($_SESSION['LADDER']);
include "general_include.php";
$page_name='replays2.php';
$IsProcess	= $_REQUEST['IsProcess'];
//############## Added By Chandan
if($_SESSION['replay_game_id']!='')
    $game_id = $_SESSION['replay_game_id'];
if(isset($_REQUEST['game_id']))
{ 
	$_SESSION['replay_game_id'] = $_REQUEST['game_id'];
    $game_id = $_SESSION['replay_game_id'];
}
//############# Added By Chandan

$ladder_id = array();
$race_id = array();
$champion_id = array();
$class_id = array();
$map_id = array();
$mode_id = array();
$team_id = array();
$type_id = array();
$versus_id = array();

//$game_id=$_REQUEST['game_id'];
$list_for=$_REQUEST['list_for'];
$sorting_by=$_REQUEST['sorting_by'];

$action=$_REQUEST['action'];
$dosearch=$_REQUEST['dosearch'];

	$ladder_id = $_REQUEST['ladder_id'];
	$race_id = $_REQUEST['race_id'];
	$champion_id = $_REQUEST['champion_id'];
	$class_id = $_REQUEST['class_id'];
	$map_id = $_REQUEST['map_id'];
	$team_id = $_REQUEST['team_id'];
	$type_id = $_REQUEST['type_id'];
	$versus_id = $_REQUEST['versus_id'];
	$mode_id = $_REQUEST['mode_id'];

$server_id = $_REQUEST['server_id'];
$region_id = $_REQUEST['region_id'];
$rating_id = $_REQUEST['rating_id'];
$availability = $_REQUEST['availability'];
$language_id = $_REQUEST['language_id'];
$price = $_REQUEST['price'];
$vdotitle = $_REQUEST['vtitle'];

/*if(is_array($ladder_id))  $ladders = implode(",",$ladder_id); else $ladders = '';
if(is_array($race_id)) $races = implode(",",$race_id); else $races = ''; 
if(is_array($champion_id)) $champions = implode(",",$champion_id); else $champions = '';
if(is_array($class_id)) $classes = implode(",",$class_id); else $classes = '';
if(is_array($map_id)) $maps = implode(",",$map_id); else $maps = '';
if(is_array($mode_id)) $modes = implode(",",$mode_id); else $modes = '';
if(is_array($team_id)) $teams = implode(",",$team_id); else $teams = '';
if(is_array($type_id)) $types = implode(",",$type_id); else $types = '';
if(is_array($versus_id)) $versuses = implode(",",$versus_id); else $versuses = '';*/

/*$action_arr=array("list_order","list_search","list_paginate");
if(in_array($action,$action_arr))
{
	$IsProcess = 'Y';
	$smarty->assign('IsProcess',"Y");
	
}
*/
//if($IsProcess <> 'Y') 	 include "top.php";

if($game_id=='')
  $GameSql = "SELECT * FROM ".TABLEPREFIX."_game WHERE is_default='Y'";
else
  $GameSql = "SELECT * FROM ".TABLEPREFIX."_game WHERE game_id='$game_id'";  

$gamerow = $UserManagerObjAjax->GetRecords("Row",$GameSql);
$game_id=$gamerow['game_id'];
$game_name=$gamerow['game_name'];

function findvalue($table,$fld_name,$fld_value,$find_value)
	{
		 if($fld_value=='')
				return false;
				
			$SelectTypeSql = "SELECT ".$find_value." FROM ".$table." WHERE $fld_name=".$fld_value;
			$SelectType = mysql_fetch_array(mysql_query($SelectTypeSql));
			return $SelectType[0];
	}	

/* Front Pagination Object Creation Starts */		
 //$PaginationFrontObj=new PaginationClassFrontAjax(15,3,1);
/* Front Pagination Object Creation Ends */
$record_per_page = !empty($record_per_page)?$record_per_page:15;
$paginationObj = new PaginationClassFrontAjax($record_per_page,3,1,'Next','Previous');


//  if($dosearch=='GO')
if($action=='send')
  {
    $SLink = '';

	/*if($ladders)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($ladders,ladder_id)";
	   $SLink.="&is_ladder=Y&ladder=R";
	} 
	if($races)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($races,race_id)";
	   $SLink.="&is_race=Y&race=R";
	} 
	if($champions)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($champions,champion_id)";
	   $SLink.="&is_champion=Y&champion=R";
	} 
	if($classes)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($classes,class_id)";
	   $SLink.="&is_class=Y&class=R";
	} 
	if($maps)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($maps,map_id)";
	   $SLink.="&is_map=Y&map=R";
	}
	if($modes)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($modes,mode_id)";
	   $SLink.="&is_map=Y&map=R";
	}
	if($teams)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($teams,team_id)";
	   $SLink.="&is_map=Y&map=R";
	}	
	if($types)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($types,type_id)";
	   $SLink.="&is_versus=Y&versus=R";
	} 
	if($versuses)
	{
	   $searchSql =  $searchSql." AND FIND_IN_SET($versuses,versus_id)";
	   $SLink.="&is_versus=Y&versus=R";
	} */
	// ===== ADDED BY TUSHAR [start] =====//
if(count($ladder_id)>0&& is_array($ladder_id)&& !empty($ladder_id))
{
	$ladders = implode(',',$ladder_id);
	$smarty->assign('ladders',$ladders);
	$searchSql =  $searchSql." AND v.ladder_id IN($ladders)";
}
if(count($race_id)>0&& is_array($race_id)&& !empty($race_id))
{
	$races = implode(',',$race_id);
	$smarty->assign('races',$races);
	foreach($race_id as $val)
	$searchSql =  $searchSql." AND FIND_IN_SET($val,v.race_id)";
}
if(count($champion_id)>0&& is_array($champion_id)&& !empty($champion_id))
{
	$champions = implode(',',$champion_id);
	$smarty->assign('races',$champions);
	foreach($champion_id as $val)
	$searchSql =  $searchSql." AND FIND_IN_SET($val,v.champion_id)";
}
if(count($class_id)>0&& is_array($class_id)&& !empty($class_id))
{
	$classes = implode(',',$class_id);
	$smarty->assign('servers',$classes);
	foreach($class_id as $val)
	$searchSql =  $searchSql." AND FIND_IN_SET($val,v.class_id)";
}
if(count($map_id)>0&& is_array($map_id)&& !empty($map_id))
{
	$maps = implode(',',$map_id);
	$smarty->assign('regions',$maps);
	foreach($map_id as $val)
	$searchSql =  $searchSql." AND FIND_IN_SET($val,v.map_id)";
}
if(count($mode_id)>0&& is_array($mode_id)&& !empty($mode_id))
{
	$modes = implode(',',$mode_id);
	$smarty->assign('ratings',$modes);
	foreach($mode_id as $val)
	 $searchSql =  $searchSql." AND FIND_IN_SET($val,v.mode_id)";
}
if(count($team_id)>0&& is_array($team_id)&& !empty($team_id))
{
	$teams = implode(',',$team_id);
	$smarty->assign('ratings',$teams);
	foreach($team_id as $val)
	 $searchSql =  $searchSql." AND FIND_IN_SET($val,v.team_id)";
}
if(count($type_id)>0&& is_array($type_id)&& !empty($type_id))
{
	$types = implode(',',$type_id);
	$smarty->assign('ratings',$types);
	foreach($type_id as $val)
	 $searchSql =  $searchSql." AND FIND_IN_SET($val,v.type_id)";
}
if(count($versus_id)>0&& is_array($versus_id)&& !empty($versus_id))
{
	$versuses = implode(',',$versus_id);
	$smarty->assign('ratings',$versuses);
	foreach($versus_id as $val)
	 $searchSql =  $searchSql." AND FIND_IN_SET($val,v.versus_id)";
}
// ===== ADDED BY TUSHAR [end]=====//

	$SearchLink="dosearch=GO".$SLink;
  } 
 
 $SearchLink= ""; // Discard Previous Values
 // 18th Oct,2011 Tushar ----------//
$duration = $_REQUEST['duration'];

if($duration == '')
  $duration = '0;60';
if(!empty($duration))
{
   $duration_range = explode(";",$duration);
   $min_duration = $duration_range[0];
   $max_duration = $duration_range[1];
   if($min_duration == '0' && $max_duration == '60')
    $sqlPart .='';
   else if($min_duration == '0' && $max_duration <60)
    $sqlPart .=" AND CAST(time_length as decimal) <='$max_duration'";
   else if($min_duration >'0' && $max_duration == '60')
    $sqlPart .=" AND CAST(time_length as decimal) >='$min_duration'";
   else 
     $sqlPart .=" AND time_length BETWEEN '$min_duration' AND '$max_duration'";		  
}
  
 if(!empty($vdotitle))
  {
    $vdoUser = "SELECT user_id from ".TABLEPREFIX."_user where name like '$vdotitle%'";
	$vdoUserArr = $UserManagerObjAjax->GetRecords("All",$vdoUser);
    for($x=0;$x<count($vdoUserArr);$x++)
	{ 
	  $uid[] = $vdoUserArr[$x]['user_id'];
	}
	$uids= implode(",",$uid);
	$searchKeyword = "video_title like '$vdotitle%' OR description like '%$vdotitle%'";
	if(count($uid)>0)
	{
	   $searchKeyword =  $searchKeyword." OR user_id IN($uids)";
	}  
    $searchSql= $searchSql." AND (".$searchKeyword.")";
  } 
//------------- Tushar [END]-----------//
 
if($IsProcess!='Y')
{
   unset($_SESSION['sql']);
   unset($_SESSION['sqlOrder']);
   unset($_SESSION['sqlPart']);
   unset($_SESSION['sort']);
 // @Addeb by Tushar --//
	
	$sortBY=explode('-',$sorting_by);
	if($list_for=="sorting"){
		if($sortBY[0]=="review"){
			if($sorting_by=="review-DESC")
			  $OrderBy = " order by (select count(*) as rev_num from ".TABLEPREFIX."_video_view_count where video_id=v.video_id) desc,v.video_title asc";
			else
			  $OrderBy = " order by (select count(*) as rev_num from ".TABLEPREFIX."_video_view_count where video_id=v.video_id) asc,v.video_title asc";
		}else{
		if($sortBY[1]=="DESC")
			$OrderBy = " order by v.".$sortBY[0]." ".$sortBY[1].",v.video_title asc";
		else
			$OrderBy = " order by v.".$sortBY[0]." ASC,v.video_title asc";
		}
	}else{
		$OrderBy = " order by v.video_id";
	}
	$smarty->assign("sorting_by",$sorting_by);
	
// @Addeb by Tushar --//
    $_SESSION['sql'] = $searchSql;
	$_SESSION['sqlOrder'] = $OrderBy;
	$_SESSION['sqlPart'] = $sqlPart;
	$_SESSION['sort'] = $sorting_by;
 
   $SelectreplaySql = "SELECT *,date_format(v.date_added,'%M %d, %Y') as video_date  FROM ".TABLEPREFIX."_video v  WHERE v.game_id='$game_id'".$searchSql.$sqlPart.$OrderBy; 
}
else
{
  $smarty->assign("sorting_by",$_SESSION['sort']);
  $SelectreplaySql = "SELECT *,date_format(v.date_added,'%M %d , %Y') as video_date  FROM ".TABLEPREFIX."_video v  WHERE 
  v.game_id='$game_id'".$_SESSION['sql'].$_SESSION['sqlPart'].$_SESSION['sqlOrder']; 
} 

 //echo $SelectreplaySql;
 $Arr = $UserManagerObjAjax->GetRecords("All",$SelectreplaySql);
 $totRec = count($Arr);
 
 //$PreserveLink="from=$from&from_page=$from_page&".$SearchLink."&".$OrderLink;
 //$preserve_variable_object->PreserveVariableUpdate($PreserveLink);
 	/* pagination starts */
 //$pagination_arr = $PaginationFrontObj->PaginationFrontAjax("PaginationFront",$SelectreplaySql,$page_name."?");	
	/* pagination ends */
 $pagination_arr = $paginationObj->PaginationFrontAjaxALL('PaginationSearch',$SelectreplaySql,$page_name.'?'.$catLink);	
 $ReplayArr = $UserManagerObjAjax->GetRecords("All",$pagination_arr[0]);
 $NumReplay = count($ReplayArr);
    for($i=0;$i<$NumReplay;$i++)
	{
		
		$ReplayArr[$i]['user'] = findvalue(TABLEPREFIX."_user","user_id",$ReplayArr[$i]['user_id'],"name");
		$totstar='';
		for($x=1;$x<=$ReplayArr[$i]['overall_rating'];$x++)
		{
		  $totstar.="<img src='images/starb.gif' alt='' border='0' />";
		}
		$istar=5 - $ReplayArr[$i]['overall_rating']; 
		for($y=1;$y<=$istar;$y++)
		{
		  $totstar.="<img src='images/starg.gif' alt='' border='0' />";
		}
		$ReplayArr[$i]['star']=$totstar;
		
		$viewCount = "SELECT count(*) FROM ".TABLEPREFIX."_video_view_count WHERE video_id =".$ReplayArr[$i]['video_id'];
		$viewArr = $UserManagerObjAjax->GetRecords("Row",$viewCount);
		$ReplayArr[$i]['view_count'] = $viewArr[0];
		
		$LikeSql = "SELECT * FROM ".TABLEPREFIX."_user_like WHERE user_id=".$ReplayArr[$i]['user_id']." AND user_type_id=".$_SESSION['user_type']." 
					AND selected_by=".$_SESSION['user_id']." AND video_id=".$ReplayArr[$i]['video_id'] ;
		$LikeArr = $UserManagerObjAjax->GetRecords('Row',$LikeSql);
		if(count($LikeArr)>0) $ReplayArr[$i]['like']='Y';
		
		$LikeNumSql = "SELECT count(*) AS numlike FROM ".TABLEPREFIX."_user_like WHERE video_id=".$ReplayArr[$i]['video_id'] ;
		$LikeArrNum = $UserManagerObjAjax->GetRecords('Row',$LikeNumSql);
		
		$ReplayArr[$i]['numlike']=$LikeArrNum['numlike'];
		$numlike[$i]=$ReplayArr[$i]['numlike'];
		
		$UnlikeNumSql = "SELECT count(*) AS numunlike FROM ".TABLEPREFIX."_user_like WHERE selected_for='D' AND  video_id=".$ReplayArr[$i]['video_id'] ;
		$UnlikeArrNum = $UserManagerObjAjax->GetRecords('Row',$UnlikeNumSql);
		
		$ReplayArr[$i]['numunlike']=$UnlikeArrNum['numunlike'];
		
	}


$gameSql = "SELECT game_id,game_name FROM ".TABLEPREFIX."_game where is_active='Y' order by game_name";
//echo $gameSql;
$GameArr = $UserManagerObjAjax->HtmlOptionArrayCreate($gameSql);

//$coachSql = "SELECT c.*,cr.* FROM ".TABLEPREFIX."_user c, ".TABLEPREFIX."_user_type_user_relation cr WHERE c.user_id=cr.user_id AND cr.user_type_id=1 AND c.is_active='Y'";
//$coachArr = $UserManagerObjAjax->GetRecords('All',$coachSql);

$replaySql="SELECT * FROM ".TABLEPREFIX."_video WHERE game_id='$game_id'".$sqlPart;// .$searchSql;
//$Arr has total records


/* find the ladder of selected game */

if($gamerow['is_ladder']=='Y' and ( $gamerow['ladder']=='R' or $gamerow['ladder']=='B' ) )
{
	$is_ladder = 'Y';
	$Selectladder="SELECT * FROM ".TABLEPREFIX."_game_ladder WHERE game_id='$game_id' and is_active='Y' order by ladder_order";
	$LadderArr=$UserManagerObjAjax->GetRecords("All",$Selectladder);
	$Numladder=count($LadderArr);
	for($gl=0;$gl<$Numladder;$gl++)
	{
		$query=$replaySql." and ladder_id=".$LadderArr[$gl]['ladder_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$LadderArr[$gl]['countrow']=count($replayCount); 
	}
}

/* find the race of selected game */
if( $gamerow['is_race']=='Y' and ( $gamerow['race']=='R' or $gamerow['race']=='B' ) )
{
	$is_race = 'Y';
	$Selectrace="SELECT * FROM ".TABLEPREFIX."_game_race WHERE game_id='$game_id' and is_active='Y'";
	$RaceArr=$UserManagerObjAjax->GetRecords("All",$Selectrace);
	$Numrace=count($RaceArr);
	for($gr=0;$gr<$Numrace;$gr++)
	{
		$query=$replaySql." and race_id=".$RaceArr[$gr]['race_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$RaceArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Champion of selected game */
if( $gamerow['is_champion']=='Y' and ( $gamerow['champion']=='R' or $gamerow['champion']=='B' ) )
{
	$is_champion = 'Y';
	$SelectChampion="SELECT * FROM ".TABLEPREFIX."_game_champion WHERE game_id='$game_id' and is_active='Y'";
	$ChampionArr=$UserManagerObjAjax->GetRecords("All",$SelectChampion);
	$NumChampion=count($ChampionArr);
	for($gr=0;$gr<$NumChampion;$gr++)
	{
		$query=$replaySql." and champion_id=".$ChampionArr[$gr]['champion_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$ChampionArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Class of selected game */
if( $gamerow['is_class']=='Y' and ( $gamerow['class']=='R' or $gamerow['class']=='B' ) )
{
	$is_class = 'Y';
	$SelectClass="SELECT * FROM ".TABLEPREFIX."_game_class WHERE game_id='$game_id' and is_active='Y'";
	$ClassArr=$UserManagerObjAjax->GetRecords("All",$SelectClass);
	$NumClass=count($ClassArr);
	for($gr=0;$gr<$NumClass;$gr++)
	{
		$query=$replaySql." and class_id=".$ClassArr[$gr]['class_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$ClassArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Map of selected game */
if( $gamerow['is_map']=='Y' and ( $gamerow['map']=='R' or $gamerow['map']=='B' ) )
{
	$is_map = 'Y';
	$SelectMap="SELECT * FROM ".TABLEPREFIX."_game_map WHERE game_id='$game_id' and is_active='Y'";
	$MapArr=$UserManagerObjAjax->GetRecords("All",$SelectMap);
	$NumMap=count($MapArr);
	for($gr=0;$gr<$NumMap;$gr++)
	{
		$query=$replaySql." and map_id=".$MapArr[$gr]['map_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$MapArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Mode of selected game */
if( $gamerow['is_mode']=='Y' and ( $gamerow['mode']=='R' or $gamerow['mode']=='B' ) )
{
	$is_mode = 'Y';
	$SelectMode="SELECT * FROM ".TABLEPREFIX."_game_mode WHERE game_id='$game_id' and is_active='Y'";
	$ModeArr=$UserManagerObjAjax->GetRecords("All",$SelectMode);
	$NumMode=count($ModeArr);
	for($gr=0;$gr<$NumMode;$gr++)
	{
		$query=$replaySql." and mode_id=".$ModeArr[$gr]['mode_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$ModeArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Team of selected game */
if( $gamerow['is_team']=='Y' and ( $gamerow['team']=='R' or $gamerow['team']=='B' ) )
{
	$is_team = 'Y';
	$SelectTeam="SELECT * FROM ".TABLEPREFIX."_game_team WHERE game_id='$game_id' and is_active='Y'";
	$TeamArr=$UserManagerObjAjax->GetRecords("All",$SelectTeam);
	$NumTeam=count($TeamArr);
	for($gr=0;$gr<$NumTeam;$gr++)
	{
		$query=$replaySql." and team_id=".$TeamArr[$gr]['team_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$TeamArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Type of selected game */
if( $gamerow['is_type']=='Y' and ( $gamerow['type']=='R' or $gamerow['type']=='B' ) )
{
	$is_type = 'Y';
	$SelectType="SELECT * FROM ".TABLEPREFIX."_game_type WHERE game_id='$game_id' and is_active='Y'";
	$TypeArr=$UserManagerObjAjax->GetRecords("All",$SelectType);
	$NumType=count($TypeArr);
	for($gr=0;$gr<$NumType;$gr++)
	{
		$query=$replaySql." and type_id=".$TypeArr[$gr]['type_id'];
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$TypeArr[$gr]['countrow']=count($replayCount); 
	}
}

/* find the Versus of selected game */
if( $gamerow['is_versus']=='Y' and ( $gamerow['versus']=='R' or $gamerow['versus']=='B' ) )
{
	$is_versus = 'Y';
	$SelectVersus="SELECT * FROM ".TABLEPREFIX."_game_versus WHERE game_id='$game_id' and is_active='Y'";
	//echo $SelectVersus;
	$VersusArr=$UserManagerObjAjax->GetRecords("All",$SelectVersus);
	$NumVersus=count($VersusArr);
	for($gr=0;$gr<$NumVersus;$gr++)
	{
		$query=$replaySql." and FIND_IN_SET(".$VersusArr[$gr]['versus_id'].",versus_id)";
		$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
		$VersusArr[$gr]['countrow']=count($replayCount); 
	}
}
/* for star rating */
for($s=1,$m=0;$s<=5;$s++) 
{
    $query=$replaySql." and overall_rating=".$s;
	$replayCount=$UserManagerObjAjax->GetRecords("All",$query); 
	
	if(count($replayCount)>0)
	{
	  $StarArr[$m]['countrow']=count($replayCount);
	  $StarArr[$m]['star']=$s;
	  $m++;
	}  
	
}

$smarty->assign("GameArr",$GameArr);
$smarty->assign('game_id',$game_id);
$smarty->assign('coach_id',$coach_id);
$smarty->assign('game_name',$game_name);
$smarty->assign('coachArr',$coachArr);
$smarty->assign("NumReplay",$NumReplay);
$smarty->assign("totRec",$totRec);

$smarty->assign('duration',$duration);

$smarty->assign('Numladder',$Numladder);
$smarty->assign('LadderArr',$LadderArr);
$smarty->assign('Numrace',$Numrace);
$smarty->assign('RaceArr',$RaceArr);
$smarty->assign('NumChampion',$NumChampion);
$smarty->assign('ChampionArr',$ChampionArr);
$smarty->assign('NumClass',$NumClass);
$smarty->assign('ClassArr',$ClassArr);
$smarty->assign('NumMap',$NumMap);
$smarty->assign('MapArr',$MapArr);
$smarty->assign('NumMode',$NumMode);
$smarty->assign('ModeArr',$ModeArr);
$smarty->assign('NumTeam',$NumTeam);
$smarty->assign('TeamArr',$TeamArr);
$smarty->assign('NumType',$NumType);
$smarty->assign('TypeArr',$TypeArr);
$smarty->assign('NumVersus',$NumVersus);
$smarty->assign('VersusArr',$VersusArr);

$smarty->assign('ladder_id',$ladder_id);
$smarty->assign('race_id',$race_id);
$smarty->assign('champion_id',$champion_id);
$smarty->assign('class_id',$class_id);
$smarty->assign('map_id',$map_id);
$smarty->assign('mode_id',$mode_id);
$smarty->assign('team_id',$team_id);
$smarty->assign('type_id',$type_id);
$smarty->assign('versus_id',$versus_id);
$smarty->assign('vdotitle',$vdotitle);

$smarty->assign('StarArr',$StarArr);
$smarty->assign('SearchLink',$SearchLink);
$smarty->assign('SLink',$SLink);
$smarty->assign("ReplayArr",$ReplayArr);
$smarty->assign('pagination_arr',$pagination_arr);
$smarty->assign('page_name',$page_name);	
$smarty->register_modifier('in_array', 'in_array');
if($IsProcess <> 'Y')
	 include "replays_leftpanel.php";
$smarty->display('replays.tpl');
//if($IsProcess <> 'Y') include "footer.php";
?>